# G3ngine CMake build system
#  ./src
#
# Indrek Sünter <IndrekSnt@hotmail.com>

# zip utility functions library
add_subdirectory (zip zip)
# OpenGL Extensions
add_subdirectory (GLee GLee)

FILE(GLOB G3_SRC_GENERAL "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
FILE(GLOB G3_SRC_FILE "${CMAKE_CURRENT_SOURCE_DIR}/file/*.cpp")
FILE(GLOB G3_SRC_MATH "${CMAKE_CURRENT_SOURCE_DIR}/math/*.cpp")
FILE(GLOB G3_SRC_RES "${CMAKE_CURRENT_SOURCE_DIR}/res/*.cpp")
FILE(GLOB G3_SRC_TEX "${CMAKE_CURRENT_SOURCE_DIR}/tex/*.cpp")
FILE(GLOB G3_SRC_BATCH "${CMAKE_CURRENT_SOURCE_DIR}/render/batch/*.cpp")
FILE(GLOB G3_SRC_RENDER "${CMAKE_CURRENT_SOURCE_DIR}/render/*.cpp")
FILE(GLOB G3_SRC_GUI "${CMAKE_CURRENT_SOURCE_DIR}/gui/*.cpp")
FILE(GLOB G3_SRC_OCT "${CMAKE_CURRENT_SOURCE_DIR}/oct/*.cpp")
FILE(GLOB G3_SRC_MD5 "${CMAKE_CURRENT_SOURCE_DIR}/md5/*.cpp")
FILE(GLOB G3_SRC_Q3 "${CMAKE_CURRENT_SOURCE_DIR}/q3/*.cpp")

set (G3_SOURCES ${G3_SRC_GENERAL} ${G3_SRC_FILE} ${G3_SRC_MATH} ${G3_SRC_RES} ${G3_SRC_TEX} ${G3_SRC_BATCH} ${G3_SRC_RENDER} ${G3_SRC_GUI} ${G3_SRC_OCT} ${G3_SRC_MD5} ${G3_SRC_Q3})

# And either an .so or .a
if (G3_BUILD_STATIC)
	add_library (G3 STATIC ${G3_SOURCES})
endif (G3_BUILD_STATIC)
if (NOT G3_BUILD_STATIC)
	add_library (G3 SHARED ${G3_SOURCES})
	target_link_libraries (G3 ${G3_LIBRARIES})
endif (NOT G3_BUILD_STATIC)

